import request from '@/utils/request'

// 创建产品bom
export function createProductBom(data) {
  return request({
    url: '/basic/product-bom/create',
    method: 'post',
    data: data
  })
}

// 更新产品bom
export function updateProductBom(data) {
  return request({
    url: '/basic/product-bom/update',
    method: 'put',
    data: data
  })
}

// 删除产品bom
export function deleteProductBom(id) {
  return request({
    url: '/basic/product-bom/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除产品bom */
export function deleteProductBomList(ids) {
  return request({
    url: `/basic/product-bom/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得产品bom
export function getProductBom(id) {
  return request({
    url: '/basic/product-bom/get?id=' + id,
    method: 'get'
  })
}

// 获得产品bom分页
export function getProductBomPage(params) {
  return request({
    url: '/basic/product-bom/page',
    method: 'get',
    params
  })
}
// 导出产品bom Excel
export function exportProductBomExcel(params) {
  return request({
    url: '/basic/product-bom/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}